package com.situ.py.service.impl;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.situ.py.service.PyUserhistoryService;
import com.situ.py.dao.PyUserhistoryDao;
import com.situ.py.common.Assist;
import com.situ.py.entity.PyUserhistory;
/**
 * PyUserhistory的服务接口的实现类
 * 
 * @author 胡文 qq:986776
 *
 */
@Service
public class PyUserhistoryServiceImpl implements PyUserhistoryService {
	private final Logger LOG = LogManager.getLogger(this.getClass());

	@Autowired
	private PyUserhistoryDao pyUserhistoryDao;

/**
* 查询....
*/
	@Override
	public List<PyUserhistory> find(PyUserhistory value) {

		List<PyUserhistory> result = pyUserhistoryDao.selectPyUserhistoryByObj(value);

		return result;
	}
    /**
* 根据id查询
*/
	@Override
	public PyUserhistory findOne(Integer id) {

		PyUserhistory result = pyUserhistoryDao.selectPyUserhistoryById(id);

		return result;
	}

/**
* 添加不为空
*/
	@Override
	public PyUserhistory saveNotNull(PyUserhistory value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行将PyUserhistory中属性值不为null的数据保存到数据库-->失败:对象不能为空");
			}
			return value;
		}
		int result = pyUserhistoryDao.insertNotNullPyUserhistory(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行将PyUserhistory中属性值不为null的数据保存到数据库-->结果:", result);
		}
		return value;
	}
	@Override
    /**
* 修改不为空
*/
	public int updateNotNullById(PyUserhistory value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过PyUserhistory的id更新PyUserhistory中属性不为null的数据-->失败:对象为null");
			}
			return 0;
		}
		int result = pyUserhistoryDao.updateNotNullPyUserhistoryById(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过PyUserhistory的id更新PyUserhistory中属性不为null的数据-->结果:", result);
		}
		return result;
	}
    /**
* 删除
*/
	@Override
	public int deleteById(Integer id) {
		if (id == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过PyUserhistory的id删除PyUserhistory-->失败:id不能为空");
			}
			return 0;
		}
		int result = pyUserhistoryDao.deletePyUserhistoryById(id);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过PyUserhistory的id删除PyUserhistory-->结果:", result);
		}
		return result;
	}


}